﻿<!doctype html>
<html>
	<head>
		<title>羽乐汇</title>
		<meta name="keywords" content="羽毛球，球会，球场，教练">
		<meta name="charset" content="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/bootstrap.min.css">
		<!-- <link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/wap_index.css"> -->
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/index.css">
		
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/jquery.min.js"></script>
		
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/bootstrap.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/md5.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/query-object.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/yuleclub.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/index.js"></script>
    </head>
	<body>
	<!-- ---------------------------------------------------------------pc_index--------------------------------------------------------- -->
		<div class="pc_coach container-fluid">
			<div class="top visible-lg visible-md">
				<div class="ttop">
					<span>欢迎来到羽乐汇</span>
					<div>
						<span class="wellcome"></span>
						<span class="login">
							<button class="login_btn">登陆</button>
							<!-- <button class="notlogin_btn">注销</button> -->
							<a href="<{:U('Index/registration')}>">注册</a>
							
						</span>
						<!-- <button class="sign_btn">注册</button> -->
						<a class="login_after" href="<{:U('User/index')}>">个人主页</a>
						<a href="__PUBLIC__/HTML/vip_center.html">vip中心</a>
					</div>
				</div>
				<div>
					<img src="__PUBLIC__/PICTURE/HomePage/logo.jpg">
				</div>
				<div class="main_nav">
					<ul>
						<li><a href="<{:U('Index/index')}>">首页</a></li>
						<li><a href="<{:U('Gymnasium/index')}>">球场</a></li>
						<li><a href="<{:U('Club/index')}>">球会</a></li>
						<li>培训</li>
						<li><a href="<{:U('Activity/activity')}>">活动</a></li>
						<li><a href="<{:U('Coach/index')}>">教练</a></li>
						<li>竞赛</li>
						<li><a href="<{:U('Announce/index')}>">公告</a></li>
					</ul>
				</div>
			</div>
			<header class="row visible-xs visible-sm header_nav">
				<a href="<{:U('Index/index')}>"><img src="__PUBLIC__/PICTURE/HomePage/pre.png"/></a>
				<span>球会页面</span>
			</header>
			<div class="search_content">
				<div class="top_search">
					<form action=" " name="search_form" method="post" >
						<select name="search_type" class="ui-select search_type f_l">
							<option value="1" {if $search_type eq 1}selected="selected"{/if}>搜球会</option>
						</select>
						<input type="text" name="search_keyword" class="" holder="请输入您要搜索的关键词" id="searchword" value="" />
						<button class="" rel="search_btn" id="searchbutton" type="button">搜索</button>
					</form>
				</div>
			</div>
			<div class="club_content">
				<div class="club_nav">
					<ul class="row list-unstyled">
						<!--<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control">
	         						<option value="">广东省</option>
	         						<option value="">山东省</option>
	         						<option value="">福建省</option>
	         						<option value="">陕西省</option>
	      						</select>
							</div>
						</li>
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control">
	         						<option value="">广东市</option>
	         						<option value="">佛山市</option>
	         						<option value="">珠海市</option>
	         						<option value="">清远市</option>
	      						</select>
							</div>
						</li>
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control">
	         						<option value="">番禺区</option>
	         						<option value="">海珠区</option>
	         						<option value="">天河区</option>
	         						<option value="">花都区</option>
	      						</select>
							</div>					
						</li>
						<li class="col-lg-1 col-md-1">
							<div class="form-group">
								<select class="form-control">
	         						<option value="">大学城</option>
	         						<option value="">官洲</option>
	         						<option value="">小洲村</option>
	         						<option value="">万胜围</option>
	      						</select>
							</div>								
						</li>
						<li class="btn_li"><button>全区</button></li>
						<li class="btn_li"><button>全市</button></li>
						<li class="btn_li"><button>全省</button></li>
						<li class="btn_li"><button>全国</button></li> -->
					</ul>
				</div>
				<div class="club_messege">
					<ul>
						<li id="total0" style="display:none;">
						<div class="alley">
						<div id="img0">
							<!--<img src="__PUBLIC__/PICTURE/HomePage/scatter.png">-->
						</div>
						<div class="message">
							<ul>
								<li id="name0"></li>
								<li id="detail0"></li>
							</ul>
						</div>	
						</div>
					</li>
					<li id="total1" style="display:none;">
					<div class="alley"> 
						<div id="img1">
							<!--<img src="__PUBLIC__/PICTURE/HomePage/scatter.png">-->
						</div>
						<div class="message">
							<ul>
								<li id="name1"></li>
								<li id="detail1"></li>
							</ul>
						</div>	
					</div>
					</li>
					<li id="total2" style="display:none;">
					<div class="alley">
						<div id="img2">
							<!--<img src="__PUBLIC__/PICTURE/HomePage/scatter.png">-->
						</div>
						<div class="message">
							<ul>
								<li id="name2"></li>
								<li id="detail2"></li>
							</ul>
						</div>	
					</div>
					</li>
					<li id="total3" style="display:none;">
					<div class="alley">
						<div id="img3">
							<!--<img src="__PUBLIC__/PICTURE/HomePage/scatter.png">-->
						</div>
						<div class="message">
							<ul>
								<li id="name3"></li>
								<li id="detail3"></li>
							</ul>
						</div>	
					</div>
					</li>
					<li id="total4" style="display:none;">
					<div class="alley">
						<div id="img4">
							<!--<img src="__PUBLIC__/PICTURE/HomePage/scatter.png">-->
						</div>
						<div class="message">
							<ul>
								<li id="name4"></li>
								<li id="detail4"></li>
							</ul>
						</div>	
					</div>
					</li>
					</ul>	
				</div>
				<div class="content_foot">
					<ul>
						<li><button class="pageup" type="button" disabled="disabled">上一页</button></li>
						<li><button class="pagedown" type="button" disabled="disabled">下一页</button></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="foot row">
			<div>
				<p>联系我们</p>
				<p>关于我们</p>
				<p>加入我们</p>
			</div>
			<div>
				<p>电话：400-800-8888 周一至周六9：00-18：00</p>
				<p>[羽乐汇]<a href="http://oto.my3w.com">http://oto.my3w.com</a></p>
			</div>
		</div>
		<script type="text/javascript">
		var province ; //省名
		var city ;  //城市名
		var district ;   //区县名
		var page_num=1; //当前页数
		var pagetype=0;
		var totalPage;
		var result_count;  //后台返回球场条数
		var clubJson;  //公告内容Json数组

		<!------------------打开页面异步加载球场------------------>

		$(function(){
			$.post('__URL__/listAllClub',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		});
		function setpage(){
			totalPage=Math.ceil(result_count/5);
			if(page_num>1){
				$(".pageup").attr('disabled',false);
			}
			else{
				$(".pageup").attr('disabled',true);
			}
			if(totalPage>page_num){
				$(".pagedown").attr('disabled',false);
			}
			else{
				$(".pagedown").attr('disabled',true);
			}
			if(page_num<totalPage){
				for (var i = 0; i <= 4; i++) {
					var img="#img"+i;
					var name="#name"+i;
					var detail="#detail"+i;
					var total="#total"+i;
					var club_picture=clubJson[i].club_picture;
					var id=clubJson[i].club_id;
					var detailurl="<{:U('Club/clubInfo')}>"+"&club_id="+id;
					$(total).css('display','block');
					$(img).html('<img src="'+club_picture+'">');
					$(name).html("球会名："+clubJson[i].name);
					$(detail).html('<a href='+detailurl+'>详情</a>');
				}
			}
			else{
				for (var i = 0; i <= result_count-(page_num-1)*5-1; i++) {
					var img="#img"+i;
					var name="#name"+i;
					var detail="#detail"+i;
					var total="#total"+i;
					var club_picture=clubJson[i].club_picture;
					var id=clubJson[i].club_id;
					var detailurl="<{:U('Club/clubInfo')}>"+"&club_id="+id;
					$(total).css('display','block');
					$(img).html('<img src="'+club_picture+'">');
					$(name).html("球会名："+clubJson[i].name);
					$(detail).html('<a href='+detailurl+'>详情</a>');
				}
				for(var i = result_count-(page_num-1)*5; i <= 4; i++){
					var img="#img"+i;
					var name="#name"+i;
					var detail="#detail"+i;
					var total="#total"+i;
					$(total).css('display','none');
					$(img).html("");
					$(name).html("");
					$(detail).html("");
				}
			}
		}
		//上一页
		$('.pageup').bind('click',function(){
			if(pagetype==0){
			page_num--;
			$.post('__URL__/listAllClub',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		}
			else{
				page_num--;
				var name=$("#searchword").val();
				$.post('__URL__/searchClub',{'name':name,'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
			}
		});
		//下一页
		$('.pagedown').bind('click',function(){
			if(pagetype==0){
				page_num++;
				$.post('__URL__/listAllClub',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		}
			else{
				page_num++;
				var name=$("#searchword").val();
				$.post('__URL__/searchClub',{'name':name,'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
			}
		});

<!----------调用百度API返回位置信息------------>
		function getLocation(){
			if (navigator.geolocation){
				navigator.geolocation.getCurrentPosition(showPosition,showError);
			}else{
		alert("浏览器不支持地理定位。");
			}
		}
		function showPosition(position){ 
    	var latlon = position.coords.latitude+','+position.coords.longitude; 
     
    	//baidu 
    		var url = "http://api.map.baidu.com/geocoder/v2/?ak=C93b5178d7a8ebdb830b9b557abce78b&callback=renderReverse&location="+latlon+"&output=json&pois=0"; 
   		 $.ajax({  
       		 type: "GET",  
       		 dataType: "jsonp",  
       		 url: url, 
      		  beforeSend: function(){ 
         		   $("#baidu_geo").html('正在定位...'); 
       		 }, 
        		success: function (json) {  
          		  if(json.status==0){ 
          		      $("#baidu_geo").html(json.result.addressComponent.city); 
          		      province=json.result.addressComponent.province;
          		      city=json.result.addressComponent.city;
          		      district=json.result.addressComponent.district;
          		  } 
      		  }, 
       		 error: function (XMLHttpRequest, textStatus, errorThrown) {  
       		     $("#baidu_geo").html(latlon+"地址位置获取失败");  
       		 } 
   		 }); 
		} 
		function showError(error){
			switch(error.code) {
				case error.PERMISSION_DENIED:
					alert("定位失败,用户拒绝请求地理定位");
					break;
				case error.POSITION_UNAVAILABLE:
					alert("定位失败,位置信息是不可用");
					break;
				case error.TIMEOUT:
					alert("定位失败,请求获取用户位置超时");
					break;
				case error.UNKNOWN_ERROR:
					alert("定位失败,定位系统失效");
					break;
 		   }
		}

		//getLocation();
		/*$.post('__URL__/listDistrictGymnasium',{'gymnasium_province':province, 'gymnasium_city':city, 'gymnasium_district':district, 'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');*/

		<!------------------搜索------------------>
		$("#searchbutton").bind("click",function(){
  			var name=$("#searchword").val();
  			page_num=1;
  			pagetype=1;
  			$.post('__URL__/searchClub',{'name':name,'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				result_count=resultList.result_count;
				clubJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		});
		</script>
	</body>
</html>